<template>
  <div>
      <h4>添加学生</h4>
      编号:<input type="text" v-model="id" class="bg"/><br>
      姓名:<input type="text" v-model="name"/><br>
       性别:<input type="radio" v-model="sex" value="男"/>男
       <input type="radio" v-model="sex" value="女"/>女
       <br>
      成绩:<input type="text" v-model="grade"/><br>
      <input type="button" value="添加" @click="add"/>
  </div>
</template>

<script>
export default {
    props:["cutBean"],
    data(){
        return {
            id:"",
            name:"",
            sex:"男",
            grade:""
        }
    },
    methods:{
        add(){
            //将属性封成学生对象
            var stuObj = {id:this.id,name:this.name,sex:this.sex,grade:this.grade};
            this.cutBean.list.push(stuObj);
        }
    }
}
</script>

<style>

</style>